package com.cz.basetool.ui_work.util.log;


import android.util.Log;

public class AndroidConsoleLogPrinter {
	public  static boolean isDebug = true;							//是否显示日志太日志
	public  static boolean outPut2LocalFile = true;					//是否输出日志到本地文件

	private static String LogControllerTag = "";

	/**
	 * 设置全局TAG标签
	 * @param logControllerTag
	 */
	public static void setLogControllerTag(String logControllerTag) {
		AndroidConsoleLogPrinter.LogControllerTag = logControllerTag;
	}

	/**
	 * 设置是否输出控制台日志
	 * @param isDebug
	 */
	public static void setDebug(boolean isDebug) {
		AndroidConsoleLogPrinter.isDebug = isDebug;
	}

	/**
	 * 设置输出控制台日志的同时是否输出到本地
	 * @param outPut2LocalFile
	 */
	public static void setOutPut2LocalFile(boolean outPut2LocalFile) {
		AndroidConsoleLogPrinter.outPut2LocalFile = outPut2LocalFile;
	}


	public static void w(String tag, String s){
		if(isDebug){
			Log.w(LogControllerTag + tag,s);
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,s);
		}
	}
	
	public static void i(String tag,String s){
		if(isDebug){
			Log.i(LogControllerTag + tag,s);
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,s);
		}
	}
	
	public static void d(String tag,String s){
		if(isDebug){
			Log.d(LogControllerTag + tag,s);
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,s);
		}
	}

	public static void e(String tag,String s){
		if(isDebug){
			Log.e(LogControllerTag + tag,s);
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,s);
		}
	}

	public static void v(String tag,String s){
		if(isDebug){
			Log.v(LogControllerTag + tag,s);
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,s);
		}
	}


	public static void w(String s){
		if(isDebug){
			Log.w(LogControllerTag ,s);
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag,s);
		}
	}

	public static void i(String s){
		if(isDebug){
			Log.i(LogControllerTag,s);
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag,s);
		}
	}

	public static void d(String s){
		if(isDebug){
			Log.d(LogControllerTag,s);
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag,s);
		}
	}

	public static void e( String s){
		if(isDebug){
			Log.e(LogControllerTag ,s);
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag,s);
		}
	}

	public static void v(String s){
		if(isDebug){
			Log.v(LogControllerTag,s);
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag,s);
		}
	}



	public static void w(String tag,Throwable e){
		if(isDebug){
			Log.w(LogControllerTag + tag,e.getMessage());
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,e.getMessage());
		}
	}

	public static void i(String tag,Throwable e){
		if(isDebug){
			Log.i(LogControllerTag + tag,e.getMessage());
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,e.getMessage());
		}
	}

	public static void d(String tag,Throwable e){
		if(isDebug){
			Log.d(LogControllerTag + tag,e.getMessage());
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,e.getMessage());
		}
	}

	public static void e(String tag,Throwable e){
		if(isDebug){
			Log.e(LogControllerTag + tag,e.getMessage());
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,e.getMessage());
		}
	}

	public static void v(String tag,Throwable e){
		if(isDebug){
			Log.v(LogControllerTag + tag,e.getMessage());
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,e.getMessage());
		}
	}

	
	public static void w(String tag,String s,Throwable e){
		if(isDebug){
			Log.w(LogControllerTag + tag,s + e.getMessage());
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,e.getMessage());
		}
	}
	
	public static void i(String tag,String s,Throwable e){
		if(isDebug){
			Log.i(LogControllerTag + tag,s + e.getMessage());
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,e.getMessage());
		}
	}
	
	public static void d(String tag,String s,Throwable e){
		if(isDebug){
			Log.d(LogControllerTag + tag,s + e.getMessage());
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,e.getMessage());
		}
	}

	public static void e(String tag,String s,Throwable e){
		if(isDebug){
			Log.e(LogControllerTag + tag,s + e.getMessage());
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,e.getMessage());
		}
	}

	public static void v(String tag,String s,Throwable e){
		if(isDebug){
			Log.v(LogControllerTag + tag,s + e.getMessage());
		}
		if(outPut2LocalFile){
			CZLocalLogPrinter.getInstance().writeLog(LogControllerTag + tag,e.getMessage());
		}
	}
}
